export default url => {
  const crud = window.$crud(url)

 const addObj = (data) => window.$axios({
  url: `datav/visual`,
  method: 'post',
  data: data
});

const getObj = (id) => window.$axios({
  url: `datav/visual/${id}`,
  method: 'get',
});

 const updateObj = (id,data) => window.$axios({
  url: `datav/visual/lrDatavVisual/${id}`,
  method: 'put',
  data: data
});



 const delObj = (id) => window.$axios({
  url: `datav/visual/${id}`,
  method: 'delete'
});
const updateState = (id,enabledMark) => window.$axios({
  url: `datav/visual/state/${id}`,
  method: 'put',
  params:{enabledMark:enabledMark}
})

 const updateComponent = (id,data) => window.$axios({
  url: `datav/visual/${id}`,
  method: 'put',
  data: data
});
const allObj = () => window.$axios({
  url: `datav/visuals`,
  method: 'get',
});
const setmodule = (data) => window.$axios({
  url: `datav/visual/setmodule`,
  method: 'put',
  data: data
});
const swiperModule = (data) => window.$axios({
  url: `system/module`,
  method: 'post',
  data: data
});
const getPage = (params) => window.$axios({
  url: `datav/visual/page`,
  method: 'get',
  params:params
})
const get = (id) => window.$axios({
  url: `datav/visual/${id}`,
  method: 'get'
})
const getByModuleId = (mid) => window.$axios({
  url: `datav/visual/getvisualbymid/${mid}`,
  method: 'get'
})
const updateStateByModuleId = (id,enabledMark) => window.$axios({
  url: `datav/visual/state/module/${id}`,
  method: 'put',
  params:{enabledMark:enabledMark}
})
const getSwiperModule = (mid) => window.$axios({
  url: `system/module/${mid}`,
  method: 'get',
})
const setSwiperModule = (mid,data) => window.$axios({
  url: `system/module/${mid}`,
  method: 'put',
  data: data
});
  
  return {
      ...crud,
      get,
      getPage,
      allObj,
      addObj,
      updateObj,
      delObj,
      updateComponent,
      getObj,
      setmodule,
      swiperModule,
      updateState,
      getByModuleId,
      updateStateByModuleId,
      getSwiperModule,
      setSwiperModule

  }
}











